import {
  BwCustomComSoltTypeEnum,
  BwCustomComNodeAttrDataTypeEnum,
  BwCustomComNodeAttrFromTypeEnum,
  BwCustomComSlotParamDataTypeEnum,
  type BwCustomComNodeAttrModel,
  type BwCustomComNodeEnableSlotInfoModel,
} from '../../../../render/models'

const attrs: Record<string, BwCustomComNodeAttrModel> = {
  autoExpandParent: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  blockNode: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  checkable: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  checkedKeys: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.array,
    constValue: '[]',
  },
  checkStrictly: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  defaultExpandAll: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  disabled: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  draggable: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  expandedKeys: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.array,
    constValue: '[]',
  },
  fieldNames: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.object,
    constValue: JSON.stringify({
      children: 'children',
      title: 'title',
      key: 'key',
    }),
  },
  loadedKeys: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.array,
    constValue: '[]',
  },
  multiple: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  selectable: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'true',
  },
  showIcon: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  showLine: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'false',
  },
  virtual: {
    valueFromType: BwCustomComNodeAttrFromTypeEnum.constValue,
    valueDataType: BwCustomComNodeAttrDataTypeEnum.boolean,
    constValue: 'true',
  },
}

const slotList: Array<BwCustomComNodeEnableSlotInfoModel> = [
  {
    visible: false,
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'switcherIcon',
      slotName: '自定义树节点的展开/折叠图标',
      slotParams: [
        {
          paramKey: 'active',
          paramName: 'active',
          paramDataType: BwCustomComSlotParamDataTypeEnum.string,
          remark: '',
        },
        {
          paramKey: 'checked',
          paramName: 'checked',
          paramDataType: BwCustomComSlotParamDataTypeEnum.boolean,
          remark: '',
        },
        {
          paramKey: 'expanded',
          paramName: 'expanded',
          paramDataType: BwCustomComSlotParamDataTypeEnum.boolean,
          remark: '',
        },
        {
          paramKey: 'loading',
          paramName: 'loading',
          paramDataType: BwCustomComSlotParamDataTypeEnum.boolean,
          remark: '',
        },
        {
          paramKey: 'selected',
          paramName: 'selected',
          paramDataType: BwCustomComSlotParamDataTypeEnum.boolean,
          remark: '',
        },
        {
          paramKey: 'halfChecked',
          paramName: 'halfChecked',
          paramDataType: BwCustomComSlotParamDataTypeEnum.boolean,
          remark: '',
        },
        {
          paramKey: 'title',
          paramName: 'title',
          paramDataType: BwCustomComSlotParamDataTypeEnum.string,
          remark: '',
        },
        {
          paramKey: 'key',
          paramName: 'key',
          paramDataType: BwCustomComSlotParamDataTypeEnum.string,
          remark: '',
        },
        {
          paramKey: 'children',
          paramName: 'children',
          paramDataType: BwCustomComSlotParamDataTypeEnum.array,
          remark: '',
        },
        {
          paramKey: 'dataRef',
          paramName: 'dataRef',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
        {
          paramKey: 'data',
          paramName: 'data',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
        {
          paramKey: 'defaultIcon',
          paramName: 'defaultIcon',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
        {
          paramKey: 'switcherCls',
          paramName: 'switcherCls',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    visible: false,
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'title',
      slotName: '自定义标题',
    },
  },
]

export const aTreeOptions = {
  attrs,
  slotList,
}
